// -----------------------------------------------------------------------------
// M A R I T I M E   R E S E A R C H   I N S T I T U T E   N E T H E R L A N D S
// -----------------------------------------------------------------------------
// Copyright (C) May 29, 2009 MARIN - All rights reserved - http://www.marin.nl
// -----------------------------------------------------------------------------
// Program  :
// Module   :
// File     : ShipForces.h
// -----------------------------------------------------------------------------

#ifndef ShipForces_H
#define	ShipForces_H

//#define DEMO

#include "defines.h"
#include "Panels.h"
#include "Array2D.h"
#include "ShipGeometry.h"

// -----------------------------------------------------------------------------
// class ShipForces
// -----------------------------------------------------------------------------
/// short description
/** long description */
// -----------------------------------------------------------------------------
class ShipForces
{
public:

    ShipForces(const ShipGeometry& ship);

    ShipForces(const ShipForces& orig);

    virtual ~ShipForces();

    ShipForces & operator=(const ShipForces& orig);

    void computeFroudeKrylov(const Array2D<REAL>& waves, REAL dx, REAL dy,
                             mml::Vector3d *pForce, mml::Vector3d* pTorque);

    double getMass();

#ifdef DEMO

    void getClippedPanels(std::vector<ShipGeometry::ExtendedPanel> *pPanels) const;

    void getWaveheightsAtCentroids(std::vector<mml::Vector3d> *pWaveheights) const;

    void getPressures(std::vector<double>* pPressures) const;

    void getForces(std::vector<mml::Vector3d> *pForces) const;

    void getTorques(std::vector<mml::Vector3d> *pTorques) const;

#endif

private:

    const ShipGeometry& m_geometry; ///< panels and more of ship
    xxship::Panels m_clippedPanels; ///< panels after clipping in earth coordinates
    double m_mass;                  ///< [kg] mass of ship (computed in still water)
#ifdef DEMO
    std::vector<mml::Vector3d> m_waveHeights; ///< [m] wave heigth at clipped panel centroids
    std::vector<double>        m_pressures;   ///< [Pa] pressure at clipped panel centroids
    std::vector<mml::Vector3d> m_forces;      ///< [N] force at clipped panel centroid
    std::vector<mml::Vector3d> m_torques;     ///< [Nm] torque at clipped panel centroid
#endif
};

#endif // ShipForces_H

